import csv
import requests
import yaml
import config.config.yaml


# 登录平台获取Token
def get_apiToken(data):
    headers = {
        "Content-Type": "application/json",
        "version": "2.0",
        "X-Encrypt-Key": "xiOqLGgy6JV1Ggs+dKc+TU/Mo/wTA8CFT5B16fRQZU8WIvtRulI0j6A204S66i5fJlksnltuVwv1WQdlKeITkx0VN/g82dn9L8s7jESTX4VfI3U31/Z/fXPhvH9j+og0jOCapYXeNZL7tQ18fXtZr2BLcjCo/Yv4X0An6Ql5C60="
    }
    url = ""
    response = requests.post(['environments']['test']['uri'], headers=headers)


# 查询projectId

#


# 打开CSV文件
with open('base_project.csv', 'r') as file:
    reader = csv.reader(file)
    next(reader)
    for row in reader:
        projectId = row[0]
        headers = {
            "Content-Type": "application/json",
            "version": "2.0",
            "X-Request-Method": "DELETE",
            "Authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3MDUwMzMwMDAsInVzZXJuYW1lIjoiZHJzX2FkbWluIn0.fdQDKm_kpsB16nYhvkQCpscauIdmx7k9Lc8LMqHS6cs"
        }

        url = f"http://api-uat.paraview.cn/api/apim/apim/api/projects/{projectId}"
        print(f"请求URL: {url}")
        response = requests.post(url, headers=headers)
        print(response.text)
